import { createRouter, createWebHistory } from 'vue-router';
import userHomeRoutes from './user-home';
import loginRoutes from './login';
import teacherResourceRoutes from './teacher-resource';
import microSceneRoutes from './micro-scene';

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'introduce',
      // 用户只有在登录时是login，正常广场页/user/  教师是/teacher/ 团队和个人的是/team/
      component: () => import('@/views/introduce/index.vue'),
    },
    // note: 不允许注册
    // // {
    // //   path: "/registration-success",
    // //   name: "registration-success",
    // //   component: () => import("@/views/Login/Registration/RegistrationSuccess/index.vue"),
    // // },
    {
      path: "/offical",
      name: "offical",
      component: () => import("@/views/Login/Registration/offical/index.vue"),
    },
    {
      path: "/privacy",
      name: "privacy",
      component: () => import("@/views/Login/Registration/privacy/index.vue"),
    },

    {
      path: "/learn/document/:courseId/:folderId/:sourceId/:filePath",
      // path: "/learn/document",
      name: "DocumentViewer",
      component: () =>
        import("@/views/Square/LearningSquare/Lesson/word/index.vue"),
      props: route => ({ sourceId: route.params.sourceId, courseId: route.params.courseId, folderId: route.params.folderId, filePath: route.params.filePath }),
    },
    {
      path: "/learn/previewdocument/:courseId/:folderId/:sourceId/:filePath",
      // path: "/learn/document",
      name: "DocumentPreViewer",
      component: () =>
        import("@/views/Square/LearningSquare/Lesson/word/previewWord.vue"),
      props: route => ({ sourceId: route.params.sourceId, courseId: route.params.courseId, folderId: route.params.folderId, filePath: route.params.filePath }),
    },
    {
      path: "/learn/video/:courseId/:folderId/:sourceId/:filePath",
      name: "video",
      component: () =>
        import("@/views/Square/LearningSquare/Lesson/video/index.vue"),
      props: route => ({ sourceId: route.params.sourceId, courseId: route.params.courseId, folderId: route.params.folderId, filePath: route.params.filePath }),
    },
    {
      path: "/learn/previewvideo/:courseId/:folderId/:sourceId/:filePath",
      name: "videoPreViewer",
      component: () =>
        import("@/views/Square/LearningSquare/Lesson/video/previewVideo.vue"),
      props: route => ({ sourceId: route.params.sourceId, courseId: route.params.courseId, folderId: route.params.folderId, filePath: route.params.filePath }),
    },

    // 登录注册路由
    ...loginRoutes,
    // 用户首页路由集合
    userHomeRoutes,
    teacherResourceRoutes,
    microSceneRoutes,
  ],
});

export default router;
